import request from '@/utils/request';

/**
 * 获取交易页信息
 * @returns 
 */
function reqTradInfo() {  
  return request({
    method:'get',
    url:'/order/auth/trade'
  })
}

/**
 * 提交订单
 * @param {string} tradeNo 交易编号(拼接在路径中)
 * @returns orderId 订单号
 */
function reqSubmitOrder({tradeNo,...data}) {  
  return request({
    method:'post',
    url:`/order/auth/submitOrder`,
    params:{
      tradeNo,
    },
    data,
  })
}


/**
 * 获取微信二维码
 * @param {string} orderId 
 * @returns 二维码信息对象
 */
function reqGetQRcode(orderId) {  
  return request({
    method:'get',
    url:`/payment/weixin/createNative/${orderId}`
  })
}

function reqQueryPayStatus(orderId) {  
  return request({
    method:'get',
    url:`/payment/weixin/queryPayStatus/${orderId}`
  })
}

function reqGetOrderList(page,limit) {  
  return request({
    method:'get',
    url:`/order/auth/${page}/${limit}`
  })
}

export {reqTradInfo,reqSubmitOrder,reqGetQRcode,reqQueryPayStatus,reqGetOrderList}